#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin>>n;
    vector <int> mon;
    for(int i=0;i<n;i++)
    {
        int t;
        cin>>t;
        mon.push_back(t);
    }
    sort(mon.begin(),mon.end());
    vector <int> pre,en;
    pre.push_back(0);
    int last=mon[0];
    int now=1;
    for(int i=1;i<n;i++)
    {
        if(last==mon[i])
        {
            now++;
            continue;
        }
        else
        {
            pre.push_back(now+*(pre.end()-1));
            en.push_back(now);
            now=1;
            last=mon[i];
        }
    }
    pre.erase(pre.begin());
    pre.push_back(now+*(pre.end()-1));
    en.push_back(now);
    int ans=0;
    for(int i=1;i<en.size();i++)
    {
        if(en[i]<=pre[i-1]-ans) ans+=en[i];
        else
        {
            ans+=pre[i-1]-ans;
        }
    }
    cout<<n-ans<<endl;
    fclose(stdin);
    fclose(stdout);
    return 0;
}
